<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
         li{
            float: left;
            list-style: none;
            text-align: center;
            padding: 10px 20px;
            background: pink;
            cursor: pointer;
        }
        li.active{
            background: teal;
            color:#fff
        }
    </style>
</head>
<body>
    <!-- 定义挂载点 -->
    <div id="app">
        <!-- 定义菜单 -->
        <ul>
            <li v-for="(item,index) in menus" :key="item.id" 
            :class="[ index == n ? 'active':'']"
            @click=" n = index "
            >{{item.title}}</li>
        </ul>
        
    </div>

    <script>
        new Vue({
            //挂载点
            el:"#app",
            //数据
            data:{
                menus:[
                    {id:1,title:"评论管理"},
                    {id:2,title:"发表评论"}
                ],
                n:0
            },
            //方法
            methods:{}
        })
    </script>
</body>
</html>